package com.github.phoenics.bazooka.restcontroller;

import com.github.phoenics.bazooka.domain.po.Student;
import com.github.phoenics.bazooka.domain.po.Teacher;
import com.github.phoenics.bazooka.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author Phoenics Chow
 * on 2019年01月27日
 */
//@RestController
//@RequestMapping("t/teacher")
public class TeacherController {
    private static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TeacherController.class);
    @Autowired
    TeacherService teacherService;

    @PostMapping("/save")
    public Boolean save(@RequestBody Teacher teacher){
        return teacherService.save(teacher);
    }
    @GetMapping("/list")
    public List<Teacher> list(){
        return teacherService.selectAllTeacher();
    }
    @GetMapping("/listby")
    public Teacher listby(){
        //teacherService.list().get(0).getStudentList()
        //teacherService.getById(1)
        return teacherService.getById(1);
    }

    @GetMapping("/listfors")
    public List<Student> listfors(){
        return teacherService.getStudentList(1L);
    }



}
